#include <OLabel.h>

OLabel::OLabel(OWidget * parent):OWidget(parent)
{
	font=NULL;
}

OLabel::~OLabel()
{
	if(font)
		font->Release( font );
}

void OLabel::SetFont(string name, int height)
{
	fontdesc.flags = DFDESC_HEIGHT;
	fontdesc.height = height;	
	if(font)
		font->Release( font );
	dfb->CreateFont( dfb, name.c_str(), &fontdesc, &font );
    surface->SetFont( surface, font );
}

void OLabel::SetText(string str)
{
	text=str;
	surface->DrawString( surface, text.c_str(), -1, 0, 0, DSTF_TOPLEFT );
	Invalid();
}